import request from './request'
import { baseUrl } from '../config/config'
// 微信登录
export const wxLogin = (params) => {
  return new Promise((resolve, reject) => {
    let successCallBack = function (res) {
      if (res.data) {
        resolve(res.data)
      }
    }
    request(successCallBack, null, baseUrl + '/wx/login', 'POST', params)
  })
}
// 根据token获取用户信息
export const login = (params) => {
  return new Promise((resolve, reject) => {
    let successCallBack = function (res) {
      if (res.data) {
        resolve(res.data)
      }
    }
    request(successCallBack, null, baseUrl + '/wx/getUserPhoneNumber', 'POST', params)
  })
}
//获取会员信息
export const memberInfo = (params) => {
  return new Promise((resolve, reject) => {
    let successCallBack = function (res) {
      if (res.data) {
        resolve(res.data)
      }
    }
    request(successCallBack, null, baseUrl + '/users/member/info', 'GET', params)
  })
}
//获取教练信息
export const coachInfo = (params) => {
  return new Promise((resolve, reject) => {
    let successCallBack = function (res) {
      if (res.data) {
        resolve(res.data)
      }
    }
    request(successCallBack, null, baseUrl + '/users/coach/info', 'GET', params)
  })
}